package efu.nf.like.web.controller;

import efu.nf.like.common.base.BaseController;
import efu.nf.like.common.result.ResultVo;
import efu.nf.like.model.dto.PostDTO;
import efu.nf.like.service.PostService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author lwj
 * @create 2025-10-13-0:03
 */
@RestController
@RequestMapping("/api/post")
@RequiredArgsConstructor
public class PostController extends BaseController {
    private final PostService postService;

    @GetMapping("/list")
    public ResultVo<List<PostDTO>> listPosts(@RequestParam Integer userId) {
        List<PostDTO> postDTOS = postService.listPosts(userId);
        return success(postDTOS);
    }
}